<?php
/** .-------------------------------------------------------------------
* |  Software: [HDCMS framework]
* |      Site: www.hdcms.com
* |-------------------------------------------------------------------
* |    Author: 向军 <2300071698@qq.com>
* |    WeChat: aihoudun
* | Copyright (c) 2012-2019, www.houdunwang.com. All Rights Reserved.
* '-------------------------------------------------------------------*/

namespace app\home\controller;

class Common{
    //动作
	public function __construct(){
		$data=Db::table('category')->where('pid',0)->limit(0,5)->get();
		foreach($data as $k=>$v){
			$data[$k]['son']=Db::table('category')->where(
				'pid',$v['cid'])
				->where('sort',2)
				->limit(0,3)
				->get();
			$data[$k]['son2']=Db::table('category')->where( 'pid',$v['cid'])
			                   ->where('sort',2)
			                   ->get();
		}

		$data1=Db::table('category')->where('pid',0)->limit(5,6)->get();
		View::with('data',$data)->with('data1',$data1);
	}
}
